/*
 * Copyright (c) 2017 22420103@QQ.COM 版权所有
 */
package com.lehe.service.impl;

import com.lehe.dao.AdminFeeReportDao;
import com.lehe.entry.FeeReportDto;
import com.lehe.entry.SqlParameterDto;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

/**
 * 类的功能描述
 *
 * @author 王丹
 * @since 2017-03-15
 */
@Service
@Transactional
public class AdminFeeReportService extends AbstractService {

    @Autowired
    AdminFeeReportDao adminFeeReportDao;

    public List<FeeReportDto> queryDayFeeReport(SqlParameterDto sqlParameterDto){
        return adminFeeReportDao.queryDayFeeReport(sqlParameterDto);
    }

    public Long queryDayFeeReportCount( SqlParameterDto sqlParameterDto){
        return adminFeeReportDao.queryDayFeeReportCount(sqlParameterDto);
    }

    public List<FeeReportDto> queryMonthFeeReport(SqlParameterDto sqlParameterDto){
        return adminFeeReportDao.queryMonthFeeReport(sqlParameterDto);
    }

    public Long queryMonthFeeReportCount( SqlParameterDto sqlParameterDto){
        return adminFeeReportDao.queryMonthFeeReportCount(sqlParameterDto);
    }

    public Double sumFee(List<FeeReportDto> listFee){
        return listFee.stream().mapToDouble(f -> f.getFee()).sum();
    }
}
